Component({
  mixins: [],
  data: {
    animation:'',
    taskBtns:'',
		overTaskBtns:'',
		// bg:{
		// 	url:'https://img.alicdn.com/imgextra/i2/4161056916/O1CN01yX5Bpy20xZqfoKl7K_!!4161056916.png',
		// 	width:680,
		// 	height:865
		// },
		taskTxt:{
			OLD_USER_DAY_ADD :{
				bgimg:"https://img.alicdn.com/imgextra/i2/4161056916/O1CN01u3jaii20xZqn19FdM_!!4161056916.png",
				btnH:'https://img.alicdn.com/imgextra/i2/4161056916/O1CN01yz5OSb20xZqj01pu6_!!4161056916.png',
				btn:"https://img.alicdn.com/imgextra/i4/4161056916/O1CN01jTFvJP20xZqmE2ZtL_!!4161056916.png",
				type:"OLD_USER_DAY_ADD",      //老用户进入
				name:"老用户",
				txt:'会员每日可额外获得'
			},
			USER_FOLLOW_DAY_ADD:{
				bgimg:"https://img.alicdn.com/imgextra/i4/4161056916/O1CN01Bd6XxC20xZqfhFQIy_!!4161056916.png",
				btnH:'https://img.alicdn.com/imgextra/i2/4161056916/O1CN01yz5OSb20xZqj01pu6_!!4161056916.png',
				btn:"https://img.alicdn.com/imgextra/i4/4161056916/O1CN01jTFvJP20xZqmE2ZtL_!!4161056916.png",
				type:"USER_FOLLOW_DAY_ADD",
				name:"粉碎专属",
				txt:'粉丝每日可额外获得'
			},
			SIGN:{ 
				bgimg:"https://img.alicdn.com/imgextra/i2/4161056916/O1CN0176IXEu20xZqZDPr0J_!!4161056916.png",
				btnH:'https://img.alicdn.com/imgextra/i4/4161056916/O1CN01pu9S6a20xZqkpkli4_!!4161056916.png',
				btn:"https://img.alicdn.com/imgextra/i1/4161056916/O1CN01TXZQ6L20xZqmyvEaP_!!4161056916.png",
				type:"SIGN",       //签到
				name:"签到",
				txt:'每日签到获得'
			},
			FOLLOW:{
				bgimg:"https://img.alicdn.com/imgextra/i2/4161056916/O1CN01WqvfsX20xZqjM9mbd_!!4161056916.png",
				btnH:'https://img.alicdn.com/imgextra/i3/4161056916/O1CN01msi5hd20xZqhm1Bg4_!!4161056916.png',
				btn:"https://img.alicdn.com/imgextra/i1/4161056916/O1CN01FA55nE20xZqfKJiwM_!!4161056916.png",
				type:"FOLLOW",       //关注
				name:"关注",
				txt:'关注店铺获得'
			},
			MEMBER:{
				bgimg:"https://img.alicdn.com/imgextra/i3/4161056916/O1CN01YNwFGm20xZqq2gGyK_!!4161056916.png",
				btnH:'https://img.alicdn.com/imgextra/i3/4161056916/O1CN014wwEDQ20xZqfCOu2k_!!4161056916.png',
				btn:"https://img.alicdn.com/imgextra/i3/4161056916/O1CN01kAJNfC20xZqnrIn3R_!!4161056916.png",
				type:"MEMBER",       //入会
				name:"入会",
				txt:'加入会员获得'
			},
			COLLECT:{
				bgimg:"https://img.alicdn.com/imgextra/i4/4161056916/O1CN011GxsJ320xZqn16dS9_!!4161056916.png",
				btnH:'https://img.alicdn.com/imgextra/i4/4161056916/O1CN01b3aUme20xZqdvVtQ4_!!4161056916.png',
				btn:"https://img.alicdn.com/imgextra/i4/4161056916/O1CN01LE840A20xZqZLJCL3_!!4161056916.png",
				type:"COLLECT",
				name:"收藏",
				txt:'收藏1个商品获得'          
			},
			SHARE:{
				bgimg:"https://img.alicdn.com/imgextra/i2/4161056916/O1CN01OL6R6220xZqnzz01F_!!4161056916.png",
				btnH:'https://img.alicdn.com/imgextra/i4/4161056916/O1CN01byGcSa20xZqfCQeAN_!!4161056916.png',
				btn:"https://img.alicdn.com/imgextra/i2/4161056916/O1CN01MS4cbK20xZqlMa5Dk_!!4161056916.png",
				type:"SHARE",
				name:"分享",
				txt:'每成功分享1个好友得',
				subTxt:'每日最多'
			},
			views:{
				bgimg:"https://img.alicdn.com/imgextra/i2/4161056916/O1CN01I2Y3TL20xZqmbXaQ1_!!4161056916.png",
				btnH:'https://img.alicdn.com/imgextra/i2/4161056916/O1CN0131EWOE20xZqignvIg_!!4161056916.png',
				btn:"https://img.alicdn.com/imgextra/i2/4161056916/O1CN01nTWMa620xZqlUBQlQ_!!4161056916.png",
				type:"views",
				name:"浏览店铺15秒",
				txt:'浏览店铺15s获得'
			},
			view:{
				bgimg:"https://img.alicdn.com/imgextra/i4/4161056916/O1CN01Ilu1uI20xZqn16ZHn_!!4161056916.png",
				btnH:'https://img.alicdn.com/imgextra/i2/4161056916/O1CN016ONwBJ20xZqiFWsBr_!!4161056916.png',
				btn:"https://img.alicdn.com/imgextra/i3/4161056916/O1CN01qEcfcI20xZqnW9rDI_!!4161056916.png",
				type:"view",
				name:"浏览直播15S",
				txt:'观看直播15s获得'
			}
		}
  },
  props: {
    taskBtns:'',
    overTaskBtns:'',
   	jifen:''
  },
  onInit(){

    this.$page.msgg = this
    
    this.setData({
      ...getApp().pifu.taskPage,
      taskBtns:this.props.taskBtns,
      overTaskBtns:this.props.overTaskBtns
    })

  },
  didMount() {
    this.animation = my.createAnimation();

    this.animation.translate('0%','150%').step()
    this.setData({ animation: this.animation.export() })

  },
  didUpdate() {},
  didUnmount() {},
  methods: {

    //接收值
    msg(msg){

      this.setData({
        
        TaskStatus:msg
      })
      
		},
		
		//兑换游戏次数
		exchange(){
			getApp().cloud.application.httpRequest({
		
			'path' : '/api/c/user/scoreChangeGameTime', 
			'method':'POST',
			'headers':{ "Content-Type":"application/json"},
			'params':{},
			'body':{},
		
			'exts':{}  }).then(res => {
				console.info('兑换游戏次数=======》',res)

				if(res.code != 200){
					my.showToast({
						content:res.msg
					});

					return
				}

				my.showToast({
					content:'兑换成功'
				})

				this.$page.changePage()


			})
		},

    closeList(){
      
      this.animation.translate('0%','-150%').step()
      this.setData({ animation: this.animation.export() })

      setTimeout(() => {
        this.$page.setData({
          isScroll:false,
          isShowTask:false
        })
      }, 400);
		},
		
		

    taskEvent(e){
			// console.log(e.currentTarget.dataset.name);
			
			if(e.target.dataset.value.total == e.target.dataset.value.count){

				my.showToast({content:'任务已完成'})

				return
			}
			
			if(e.currentTarget.dataset.name=="USER_FOLLOW_DAY_ADD"){

				my.showToast({content:'关注店铺后第二天开始，每天增加游戏次数'})

				return
			}

			if(e.currentTarget.dataset.name=="OLD_USER_DAY_ADD"){

				my.showToast({content:'加入会员后第二天开始，每天增加游戏次数'})

				return
			}




			// this.$page[e.currentTarget.dataset.name]();		


      if(e.currentTarget.dataset.name=="SIGN" || e.currentTarget.dataset.name=="view" || e.currentTarget.dataset.name=="views" ){
				// this.$page.sign();
				
				this.$page.complete(e)

      }else if(e.currentTarget.dataset.name=="FOLLOW"){
        this.$page.favorShop();
      }else if(e.currentTarget.dataset.name=="MEMBER"){

        // 入会官方插件
        this.$page.TestingMembers();
        
        // 自己的入会接口
        // this.$page.joinMember();
        
      }else if(e.currentTarget.dataset.name=="COLLECT"){
        this.$page.collectGoods();
      }else if(e.currentTarget.dataset.name=="SHARE"){
        this.$page.share();
      }else{
        
        
      }

      return;
      // if(e.currentTarget.dataset.name==0){
      //   //老用户
      //   //this.$page.sign();
      // }else if(e.currentTarget.dataset.name==1){
      //   //签到
      //   this.$page.sign();
      // }else if(e.currentTarget.dataset.name==2){
      //   //关注
      //   this.$page.favorShop();
      // }else if(e.currentTarget.dataset.name==3){
      //   //入会
      //   this.$page.joinMember();
      // }else if(e.currentTarget.dataset.name==4){
      //   //收藏
      //   this.$page.collectGoods();
      // }else{
      //   //分享
      //   this.$page.share();
      // }
    },

    // 签到
    sign(){

      //在这里处理那边return出来的数据
      //console.log(this.$page.sign())
    
    },

    // 关注店铺
    favorShop(){
      
    },

    // 加入会员
    joinMember(){
      
    },

    // 收藏
    collectGoods(){
      
    },

    // 分享
    share(){
      
    }

  },
});
